﻿// <copyright file="GeneralTransform3DTo2D.cs" company="Axelerate Solutions S.A.">
// Copyright (c) Axelerate Solutions S.A.  All rights reserved.
// </copyright>
namespace Axelerate.Silverlight3D.Media.Media3D
{
    using System;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Ink;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
        
    /// <summary>
    /// File name: GeneralTransfor3DTo2D.cs
    /// Company: Axelerate Solutions S.A.
    /// Created By: Daniel Rojas
    /// Created Date: 11/01/2008 18:19:00 h.
    /// Description: Provides 3-D to 2-D transformation support.
    ///   <Modifications>
    ///   </Modifications>
    /// </summary>
    public class GeneralTransform3DTo2D : Freezable
    {
        /// <summary>
        /// Create a instance of the GeneralTransform3DTo2D class with the asociated tranformation
        /// </summary>
        /// <param name="transform">Matrix3D with the respective tranformation to be used by this class</param>
        internal GeneralTransform3DTo2D(Matrix3D transform)
        {
            this.Matrix = transform;
        }

        /// <summary>
        /// Transforms the specified 3-D point and returns the result.
        /// </summary>
        /// <param name="point">The 3-D point to transform.</param>
        /// <returns>The result of transforming point.</returns>
        public Point Transform(Point3D point)
        {
            Point3D p = this.Matrix.Transform(point);
            return new Point(p.X, p.Y);
        }

        private Matrix3D Matrix
        {
            get;
            set;
        }
    }
}
